<%@ page import="Domain.topr2" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<html>
<head>
    <title></title>
    <meta charset="UTF-8">
    <link rel="stylesheet" type="text/css" href="../css/bootstrap.css" />
    <link rel="stylesheet" type="text/css" href="../css/bootstrap-responsive.css" />
    <link rel="stylesheet" type="text/css" href="../css/style.css" />
    <script type="text/javascript" src="../js/jquery.js"></script>
    <script type="text/javascript" src="../js/bootstrap.js"></script>
    <script type="text/javascript" src="../js/ckform.js"></script>
    <script type="text/javascript" src="../js/common.js"></script>
    <!-- 引入 ECharts 文件 -->
    <script src="../js/echarts.min.js"></script>
    <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css">
    <script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
    <script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
    <script src="../js/bootstrap.min.js"></script>
    <script src="../js/paging.js"></script>
    <link href=" http://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet" >
    <stript scr="http://cdn.bootcss.com/bootstrap/3.2.0/js/bootstrap.min.js"></stript>
    <script scr="http://cdn.bootcss.com/jquery/1.11.1/jquery.min.js"></script>

    <!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css" integrity="sha384-HSMxcRTRxnN+Bdg0JdbxYKrThecOKuH5zCYotlSAcp1+c8xmyTe9GYg1l9a69psu" crossorigin="anonymous">

    <!-- 可选的 Bootstrap 主题文件（一般不用引入） -->
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap-theme.min.css" integrity="sha384-6pzBo3FDv/PJ8r2KRkGHifhEocL+1X2rVCTTkUfGk7/0pbek5mMa1upzvWbrUbOZ" crossorigin="anonymous">

    <!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js" integrity="sha384-aJ21OjlMXNL5UyIl/XNwTMqvzeRMZH2w8c5cRVpzpU8Y5bApTppSuUkhZXN0VxHd" crossorigin="anonymous"></script>
    <style type="text/css">
        body {
            padding-bottom: 40px;
        }
        .sidebar-nav {
            padding: 9px 0;
        }

        @media (max-width: 980px) {
            /* Enable use of floated navbar text */
            .navbar-text.pull-right {
                float: none;
                padding-left: 5px;
                padding-right: 5px;
            }
        }

         .black_overlay{
             display: none;
             position: absolute;
             top: 0%;
             left: 0%;
             width: 100%;
             height: 100%;
             background-color: black;
             z-index:1001;
             -moz-opacity: 0.8;
             opacity:.80;
             filter: alpha(opacity=88);
         }
        .white_content {
            display: none;
            position: absolute;
            top: 25%;
            left: 25%;
            width: 55%;
            height: 55%;
            padding: 20px;
            border: 10px solid orange;
            background-color: white;
            z-index:1002;
            overflow: auto;
        }
    </style>
    <script>
        function jumptoadd(){
            window.location.href="${pageContext.request.contextPath}/dorm/add.jsp";
        }
        function deleteUser(id){
            if(confirm("您确定要删除吗？")){
                location.href="${pageContext.request.contextPath}/OrdersServlet?action=Delete&id="+id;
            }
        }

        window.onload = function (){
            //为删除选中按钮添加单击事件
            document.getElementById("delSelected").onclick = function (){
                if(confirm("您确定要删除的条目吗吗？")){
                    var flag = false;
                    //判断是否有选中checkbox(防止空指针异常)
                    var cbs = document.getElementsByName("oid");
                    for (var i = 0; i < cbs.length; i++) {
                        if(cbs[i].checked){
                            //如果有一个条目被选中了
                            flag = true;
                            break;
                        }
                    }
                    if(flag){
                        //有条目被选中才能提交表单
                        //表单提交
                        document.getElementById("form").submit()
                    }
                }
            }


            document.getElementById("firstCb").onclick = function (){
                //获取后面所有的checkbox
                var cbs = document.getElementsByName("oid");
                //3.遍历
                for (var i = 0; i < cbs.length; i++) {
                    //设置这些cbs[i]的check状态 为最顶上哪个checkbox的状态
                    cbs[i].checked = this.checked;
                }
            }
        }

    </script>
    <script>
        function openwin(ooid,uid) {
            window.open ("${pageContext.request.contextPath}/OrdersServlet?action=new&ooid="+ooid+"&uid="+uid, "newwindow", "height=500, width=800, toolbar =no, menubar=no, scrollbars=no, resizable=no, location=no, status=no") //写成一行
        }
    </script>
</head>
<body>

<form id="form" action="${pageContext.request.contextPath}/OrdersServlet?action=DelSelected" method="post">
    <table id="chargeTab" class="table table-bordered table-hover definewidth m10">
        <thead>
        <tr>
            <td><input type="checkbox" id="firstCb"></td>
            <th>订单号</th>
            <th>下单用户</th>
            <th>地址</th>
            <th>电话号码</th>
            <th>状态</th>
            <th>总价</th>
            <th>详情</th>
            <%--<th colspan="8">--%>
            <c:forEach items="${pb}" var="o" varStatus="c">
        <tr>
            <td><input type="hidden" name="oid" value="${o.id}"></td>
            <td>${o.id}</td>
            <td>${user.username}</td>
            <td>${o.address}</td>
            <td>${o.tel}</td>
            <td>${o.orderstatus}</td>
            <td>${o.ordersum}</td>
            <td><a href="#" onclick="openwin(${o.id},${user.id})">查看详情</a></td>

        </tr>
        </c:forEach>

        </tr>
        </thead>
    </table>
</form>

<a class="btn btn-default" href="${pageContext.request.contextPath}/UserServlet?action=BackToIndex&id=${user.id}" role="button" style="align-content: center">返回</a>

</body>
</html>



